package cn.tedu.encoding;

import javafx.scene.chart.ScatterChart;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;

/**
 * @author :Colin
 * @version 创建时间: 2021/6/18 14:24
 */
/*本类用于测试编码转换表*/
/*常用编码utf-8与gbk如果出现乱码的情况，一定是编写与查看时的编码不一致*/
public class TestEncode {
    public static void main(String[] args) {
        OutputStreamWriter out =null;
        try{
            out = new OutputStreamWriter(new FileOutputStream("d:\\punk\\1.txt"),"gbk");
            out.write("今天星期五");
            System.out.println("执行成功");
        }catch(Exception e){
            System.out.println("执行不成功");
            e.printStackTrace();
        }finally{
            try {
                out.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

}
